#ifndef __BUOLA_SCENE_CIMAGERENDERER_H__
#define __BUOLA_SCENE_CIMAGERENDERER_H__

#include <buola/image/format.h>
#include <buola/scene/crenderer.h>
#include <buola/gl/cframebuffer.h>

namespace buola { namespace scene {

class CImageRenderer : public CRenderer
{
public:
    CImageRenderer();
    ~CImageRenderer();

public:
    void GetImage(const img::CMView_rgb8 &pImage);
    void GetImage(const img::CMView_rgb8 &pImage,const img::CMView_gray32 &pDepth);
    void GetImage(const img::CMView_rgb8 &pImage,const img::CMView_gray32 &pDepth,
                  const img::CMView_gray8 &pTransformIndex,std::vector<PTransform> &pTransforms);
    void GetImage(const img::CMView_gray8 &pImage,const img::CMView_gray32 &pDepth);
    
private:
    void InitContext(const CSize_i &pSize,int pNumBuffers);
    void CreateBuffers(const CSize_i &pSize);
    
private:
    CSize_i mSize;

    bool mHaveBuffers;
    
    gl::CRenderBuffer mRenderBuffer;
    gl::CRenderBuffer mDepthBuffer;
    gl::CRenderBuffer mTransformIndexBuffer;
    gl::CFrameBuffer mFrameBuffer;

    std::unique_ptr<img::CGC> mGC;
};

/*namespace scene*/ } /*namespace buola*/ }

#endif
